(navigation image)
Home American Libraries | Canadian Libraries | Universal Library | Community Texts | Project Gutenberg | Children's Library | Biodiversity Heritage Library | Additional Collections
Search: Advanced Search
Anonymous User (login or join us)
Upload
See other formats

Full text of "Arduino"

Drive a 7-Segment LED with an Arduino 



i 



Make Projects 



build, hack, tweak, share, discover, J 



Drive a 7-Segment LED with an 



Arduino 



Written By: Riley Porter 



f TOOLS: 



Arduino microcontroller (1) 



© PARTS: 

• misc resistors (2) 

Close to 220 Ohms is good enough. 

• Mini breadboard (1) 

• Connecting (juniper) wires (11) 



SUMMARY 

Using the Arduino development platform you will learn how to display numbers and letters on 
a single 7-segment LED display. There are many ways to drive 7-segment displays, and this 
is a fairly simple method. However, using this method to drive even one LED 7-segment 
array "burns" (occupies) many of the digital I/O pins on your Arduino. In later projects, I'll 
show you how to use a dedicated 7-segment LED driver. 



© Make Projects 



www.makeprojects.com 



Page 1 of 5 



Drive a 7-Segment LED with an Arduino 





• Gather up your gear: 

• Two 220-ohm resistors (close to 
that value is good enough) 

• 11 male-to-male jumper wires 

• 1 Breadboard 

• 1 Arduino Development Board 



■ ■ ■ ■ — ^ r i i 



I . I I . . . . ■ _ _ _ _ ____. . .. 



■ I ■ ■ I 

-■ ■ 



... . . . 




' » - - llfl 



A. 
£ DP 



[> DP 



■o. a 



c: 
D 

DP 



auft 



3t 



3B 



D C 



:[ ]: i ]L i a jl i j 

DEF-SDP ABC1D 



->-■ 



::*;;][ 



H G 



U fc 



76*218 10 5 



6 4 2 1 9 14 S T G 4 ? - 



f 



■J 
o 10 



4 X 

DP 



Wire up your segment. Use the Fritzing image as your guide. 

• A = 8, B = 9, C=2, D=3, E=4, F=5 5 G=6 

• The two middle pins (Pin 3 and Pin 8) on top and bottom go to Ground (or to the first leg 
of the 220 ohm resistor). These are our current-limiting resistors. 



© Make Projects 



www.makeprojects.com 



Page 2 of 5 



Drive a 7-Segment LED with an Arduino 




© Make Projects www.makeprojects.com Page 3 of 5 



Drive a 7-Segment LED with an Arduino 




_7_MfliPt-M i 



W:t PrajKtsi nw to ITL^ g 7 5*flKf". LET* 

Hi; 

By; BHoy Pcrtir 

Jhis is at intiesi*ti$n ^rt now «4 flrirt- a ? U^ttiL LCf utLirj only a Ae-anr*. This 1* 

rat Che twit my to So WLs. "his is «artl to be c (earning e*>c?nclH. In Icter tutorials 



»i-f'.i,- A B 

Kfcf'.n? c : 
liT-i.' D 1 
Mtn.fi* E 4 
■»'lno F 5 
Mefinf E & 



cMcirO 

dlgltalWItefjA, HIGH)] 

aia.italW1t,S. met))* 
EHajltaLWltaffi, KICK); 
digital*? I ISQ), HICHJ- 
dlgltolWiitari, HIGH); 
dlairjUWltorf , KICK): 
dl4ltGl*llt?{15, WJOfli 



void *flr_A.^) 
dial tdl ti i ts (b, 

<ll9ltK|V<il.i7S, 

iJLii t.?l*Tit;(Vi 
DlSit<=l*5|ip(5, 
di»ltslYiite(A, 

dlQUCIlftoln^, 

dialtolWltafJC, 

> 
z 

,vt<i;pl^i B 
dlgltGlWritarJft, 
dlgil talifc i IcflE, 
rtgltaLMIUff, 

dlaltalttrlteQi, 
«l9tt4lWrl«rt, 
diQitaltt?ite(B B 






lov}: 
lift, 

loty. 
i»ISO; 

f ICHJ" 



cf.-vihid. 




• Load the code and you're good to 
go: 

• Get the code from here: 
http://bit.ly/ia3lv7 

• If you copy and paste the code into 
your Arduino sketch, you will see 
that if everything is hooked up 
correctly, it will loop from A-F then 
1 - 0. This is not the most 
interesting project. However it does 
lay the groundwork for displaying 
data on a 7-segment LED for your 
Arduino projects. 

• The approach we used to drive this 
one 7-segment LED took 8 of our 
digital I/O lines. This is quite a few 
lines to "burn" for this functionality. 
However in upcoming tutorials, I 
will post some more elegant ways 
to drive 7-segment displays than 
using 8 digital I/O lines. 

• In the code there are 15 functions 
that will display the letter or 
number represented by the function 
name on the LED display. For 
example, if you were to run 
seven ( ) , this would display the 

number 7 on the display. If you 
write a Pin LOW, you are in fact 
turning on that LED. If you write a 
pin HIGH it is now turned off. 

• That's it! All you have to do now is 
to program it to display something 
useful for your project. 



© Make Projects 



www.makeprojects.com 



Page 4 of 5 



Drive a 7-Segment LED with an Arduino 

This document was last generated on 201 2-1 1 -01 02:53:40 AM. 



© Make Projects www.makeprojects.com Page 5 of 5